<!--
 * @Author: 汪军 624473119@qq.com
 * @Date: 2023-10-10 18:15:53
 * @LastEditors: 汪军 624473119@qq.com
 * @LastEditTime: 2023-10-23 13:49:40
 * @FilePath: \ekee-web\src\views\end\easy-link\EasyLink.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template lang="pug">
.agreement.py4
  .content
    .content-tittle.flex.justify-center {{ contentTittle }}
    div(v-html="content")
</template>

<script setup>
import { ref, onMounted } from "vue";
import { useRoute } from "vue-router";
import { UserAgreement, PrivacyAgreement } from "@/api/common.js";

const route = useRoute();
const contentTittle = ref("");
const content = ref("");
onMounted(() => {
  // console.log("1111", route.query.type);
  const type = route.query.type;
  if (type == 1) {
    // 用户协议
    getUseronfoAgreement();
    contentTittle.value = "易可易平台用户协议";
  } else {
    // 隐私政策
    getUseronfoPrivacyPolicy();
    contentTittle.value = "易可易平台隐私政策";
  }
});
// 用户协议
const getUseronfoAgreement = () => {
  UserAgreement()
    .then((res) => {
      if (res.code == 1) {
        // ElMessage({ message: res.msg, type: "success" });
        // console.log("res", res.data.content);
        content.value=res.data.content
      } else {
        ElMessage({ message: res.msg, type: "error" });
      }
    })
    .catch((error) => {
      ElMessage({ message: error.msg, type: "error" });
    });
};
// 隐私政策
const getUseronfoPrivacyPolicy = () => {
  PrivacyAgreement()
    .then((res) => {
      if (res.code == 1) {
        // ElMessage({ message: res.msg, type: "success" });
        // console.log("res", res.data.content);
        content.value=res.data.content

      } else {
        ElMessage({ message: res.msg, type: "error" });
      }
    })
    .catch((error) => {
      ElMessage({ message: error.msg, type: "error" });
    });
};
</script>

<style lang="stylus" scoped>
.agreement {
  background: #ffffff;
  min-height: calc(100vh - 88px);
  box-sizing: border-box;

  .content {
    width: 1200px;
    margin: 0 auto;
  }

  .content-tittle {
    font-size: 22px;
    font-family: PingFang SC, PingFang SC;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.87);
  }
}
</style>
